<include file="public@header" />
<style type="text/css">
	.title{
		font-weight: bold;
		font-size: 3rem;
		padding-bottom: 10px;
		border-bottom: 2px solid #333;
	}
	.arrows_item{
		cursor:hand;
	}
	table .item_btn{
		background: #f2f2f2;
		border: 1px solid #e5e5e5;
		height: 32px;
		width: 32px;
		line-height: 20px;
		padding: 5px;
		display: inline-block;
		text-align: center;
		color: #9e9e9e;
	}
	#category_item tr{
		pointer-events:auto
	}
	.form-group{
		padding:0px 15px;
	}
	.save_detail{
		margin-left: 50px;
	}
	.form2{
		padding: 10px;
	}
	.item_type_control{
		text-align: right;
		padding-right: 15px;
	}

	.show-data{
		padding: 7px;
	}
</style>
</head>
<body>
	<div class="wrap">
		<form method="post" class="form-horizontal" id='form1'>
			<foreach name='item' id='vo'>
			    <div class="form-group">
			    	<label for="input-{$vo['item_hex']}" class="col-sm-2 control-label">{$vo['item_name']}</label>
				    <div class="col-sm-10">
				    	<empty name="vo['item_type']">
				    		<label class="show-data">
				    			<in name="$vo['item_hex']" value="create_time,update_time">
									{$data[$vo['item_hex']]|date="Y-m-d H:i:s",###}
								<else/>
									<eq name="$vo['item_hex']" value="status" >
										<switch name="$data[$vo['item_hex']]">
								    		<case value="1">
										    	<td><span class="text-success">正常</span></td>
										    </case>
										    <case value="2">
										    	<td><span class="text-danger">删除</span></td>
										    </case>
										    <case value="3">
										    	<td><span class="text-warning">异常</span></td>
										    </case>
										    <default />{$data[$vo['item_hex']]}
								    	</switch>
									<else/>
										{$data[$vo['item_hex']]}
									</eq>
				    				
								</in>
				    		</label>
						<else />
							<switch name="vo['item_type']">
							    <case value="2">
							    	<foreach name="$vo['item_value']" id='item'>
							    		<label class="show-data">
									      <input 
									      	<eq name="item" value="$data[$vo['item_hex']]">checked</eq> 
									      	name="{$vo['item_hex']}" value="{$item}" type="radio"> {$item}
									    </label>
							    	</foreach>
							    </case>
							    <case value="3">
							    	<foreach name="$vo['item_value']" id='item'>
							    		<label class="show-data">
									      <input 
									      	<in name="item" value="$data[$vo['item_hex']]">checked</in>
									      	name="{$vo['item_hex']}[]" value="{$item}" type="checkbox"> {$item}
									    </label>
							    	</foreach>
							    </case>
							    <default />
				        		<input type="text" name="{$vo['item_hex']}" class="form-control" id="input-{$vo['item_hex']}" value="{$data[$vo['item_hex']]}" placeholder="{$vo['item_name']}">
							</switch>
						</empty>
				    </div>
			    </div>
			</foreach>
			<a href="javascript:void(0)" class="btn save_detail btn-info">{:lang('SAVE')}</a>
		</form>
	</div>
	<script src="__STATIC__/js/admin.js"></script>
	<script type="text/javascript">
		$(function(){
			$(".save_detail").bind('click', function(){
				var data = $("#form1").serialize();

				$.ajax({
					url: window.location.href,
					type: 'POST',
					dataType: 'json',
					data: data,
					success: function(res){
						if(res.code > 0){
							layer.msg('编辑成功');
							setTimeout(function(){
	  							window.location.href = window.location.href;
							}, 500);
		  				}else{
		  					layer.alert(res.msg, {
							  icon: 2,
							});
		  				}
					}
				})
			})
		})
	</script>
</body>
</html>